<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"
		type="text/javascript"></script>

<style>
body {
    padding: 8%;
    font-family: sans-serif;
    font-size: 14pt;
    overflow: hidden;
}

body div.slide {
    display: none;
    width: 65%;
    margin-left: auto;
    margin-right: auto;
}

blockquote, code {
	font-family: monospace;
}

a {
	color: inherit;
}

img {
	display: block;
	margin-left:auto;
	margin-right:auto;
}

hr {
  border: 0px;
  height: 3px;
  background-color: #aaa;
}
</style>
	
<title>luminescence/presentation</title>

</head>
<body>

%INCLUDE: SLIDES%

<script type="text/javascript">
%INCLUDE: PROPERTIES%
</script>

<script type="text/javascript">
	var KP_END = 35
	var KP_HOME = 36
	var KP_LEFT = 37
	var KP_UP = 38
	var KP_RIGHT = 39
	var KP_DOWN = 40

	var KP_PREV = [KP_LEFT, KP_UP]
	var KP_NEXT = [KP_RIGHT, KP_DOWN]

	var FIRST_SLIDE = 1
	var LAST_SLIDE = %INCLUDE: SLIDES_NUM%

	$('document').ready(function() {
		current_slide = FIRST_SLIDE; 
		go_to(current_slide);
	});
	
	$(window).keydown(function(event) {
		key = event.keyCode;
		if (in_list(key, KP_PREV) && current_slide > FIRST_SLIDE) {
			go_to(previous_slide())
		} else if (in_list(key, KP_NEXT) && current_slide < LAST_SLIDE) {
			go_to(next_slide())	
		} else if (key == KP_HOME) {
			go_to(FIRST_SLIDE)
		} else if (key == KP_END) {
			go_to(LAST_SLIDE)
		}
	});

	function previous_slide() {
		if (current_slide > FIRST_SLIDE) {
			return current_slide - 1
		}
		return FIRST_SLIDE;
	}

	function next_slide() {
		if (current_slide < LAST_SLIDE) {
			return current_slide + 1
		}
		return NEXT_SLIDE;
	}

	function go_to(slide) {
		fade_out_duration = property(current_slide, 'fade-out', 0) / 2;
		fade_in_duration = property(slide, 'fade-in', 0) / 2;
		$('#' + current_slide).fadeOut(fade_out_duration, function() {
			current_slide = slide;
			set_foreground();
			set_linkcolor();
			set_background();
			$('#' + current_slide).fadeIn(fade_in_duration);
		});
	}

	function property(slide, key, default_value) {
		value = properties[slide + "." + key];
		if (value != undefined) return value
		else return default_value			
	}

	function set_foreground() {
		var foreground_color = property(current_slide, 'foreground-color', 'black')
		$('body').css('color', foreground_color);
	}

	function set_linkcolor() {
		var link_color = property(current_slide, 'link-color', 'inherit')
		$('a').css('color', link_color);
	}

	function set_background() {
		var background_color = property(current_slide, 'background-color', 'white')
		$('body').css('background-color', background_color);
	}

	function in_list(key, list) {
		for (var each in list) {
			if (key == list[each]) return true;
		}
		return false;
	}
</script>

</body>
</html>